package com.example.stu1.score.controller;

import com.example.stu1.score.pojo.Score;
import com.example.stu1.score.service.ScoreService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;

@RestController
@RequestMapping("/score")
public class ScoreController {
    @Resource
    private ScoreService service;

    @RequestMapping("/add")
    public void add(Score score) {
        service.addScore(score);
    }

    @RequestMapping("/query")
    public ArrayList<Score> query() {
        return service.queryScore();
    }

    @RequestMapping("/delete")
    public void delete(Score score) {
        service.deleteScore(score);
    }

    @RequestMapping("/update")
    public void update(Integer score,Integer scId) {
        service.updateScore(score,scId);
    }

    @RequestMapping("/get")
    public Score get(Integer scId) { return service.getScore(scId); }

    @RequestMapping("/query2")
    public ArrayList<Score> query2(Integer sno) {
        return service.ScoreSno(sno);
    }

    @RequestMapping("/query3")
    public ArrayList<Score> query3(Integer cno) {
        return service.ScoreCno(cno);
    }

    @RequestMapping("/query4")
    public ArrayList<Score> query4(Integer sno,Integer cno) {
        return service.ScoreSc(sno, cno);
    }
}
